************************* Use C-Pg Up to return *******************************
********************* Use Pg Up and Pg Dn to scroll ***************************
*************************** Use C-s to search *********************************
Copyright (C) 1993 Leon van Dommelen      There is no warranty on this software

			Memory Constraints

This subject deals with possible lack of DOS memory during shelling.
It does not discuss running out of memory while only editing;
See subject:	Intro, topic Limitations	for lack of memory for editing

Whenever you shell to DOS, execute a DOS command, compile a Fortran file, or
TeX a TeX file, Emacs will stay in memory.  As a result, memory available
for DOS will be tight: your task may execute v..e..r..y slowly or fail
completely.  Below are some ways to fight this problem.


Topics:
-------------------------------------------------------------------------------
Conserve Memory			Avoid loading too much
Exit Temporarily		Emacs will recover automatically
Other				Other possibilities



			= Conserve Memory =
-------------------------------------------------------------------------------

The most obvious approach is to keep the amount of memory used by Emacs to a
minimum.  Keep an eye on end of the status line: it shows the memory used by
the current edit buffer.  You can often edit smaller segments separately.
You may have additional buffers (*Help*, .edd buffers, ...); use
C-Pg Dn to check and C-x k to get rid of redundant buffers.

Also keep an eye on the start of the status line; it shows the editing modes
actually loaded. All of these take memory according to the size of the
corresponding .ED file.  The mode line will always show F for Fundamental, K
for Keys, and P for Mouse. However, you may also see T for TeX if you are
editing a TeX file, or N for Fortran. You will see D for dired if you loaded
a directory, for example to select a file.  You will see A for Abbrev if you
expanded abbreviations using C-x '.  The way to get rid of redundant editing
modes is to exit Emacs and start fresh.

If you change the editor, you load library M, but in addition one or more
.EDD documentation files.  The best is to exit after changing the editor.

Note that if you see A for Abbrev, you will also have all user-defined
abbreviations loaded.  TeX and Fortran modes have alternate keys instead of
C-x ' to expand pre-defined abbrevs.  If you use those keys, you will not
load Abbrev mode, nor the user-defined abbrevs.  It is usually better to add
a pre-defined abbrev to tex.min or fortran.min than to define it on-the-fly,
since the pre-defined ones are only loaded when the editing mode itself is
loaded.

Saved Learn sequences also take memory, depending on the amount and type of
the keystrokes. Use M-x erase-kbd-macro to get rid of ones you do not use.

Being frugal with memory has limitations: the Emacs executable, fundamental
commands, key definitions, and mouse commands take 140k of memory by
themselves. The bottom line is that you won't run emTeX from within Emacs on
a 512k machine.


			= Exit Temporarily =
-------------------------------------------------------------------------------

The only way to make sure that you get all memory is to exit Emacs.
Exiting can be done automatically. To enable it, use M-x set-some-options to
clear the value of the secondary command shell F-shell-program.

With F-shell-program cleared, Emacs replaces any shell to DOS with an exit
to DOS.  To reload emacs and continue where you left off, you must issue an
$-EMACS command from DOS.  If Emacs shelled to perform a DOS task such as
compile a buffer, the $-EMACS command will first perform that task before
reloading Emacs.

You may avoid issuing $-EMACS from DOS by running emacs from a batch file
such as CEMACS.BAT (edit this file first to correct the directories).
If you use CEMACS, you should also use M-x set-some-options to set the Emacs
recall command to C:\EMACS\CEMACS CONTINUED instead of EMACS CONTINUED.

The name of the secondary command shell to use must be set separately
for the Fortran and TeX modes using M-x fortran-set-options or M-x
TeX-set-options. For example, you may want to blank out the secondary
command shell only in TeX-mode.  In that case Emacs will only exit when
you perform a DOS TeX command such as TeX-buffer.

NOTE:

1. For some tasks, such as reading in directories in Dired mode, EMACS uses
the standard DOS shell COMSPEC.  Changing the secondary command shell does not
affect those tasks.

2. During a tenporary exit, you do not need to save buffers without files;
these buffers will be restored on re-entry.

Exiting has the disadvantage that you have to issue a separate $-EMACS
command, unless you are using CEMACS.BAT.  In any case, it requires you
to decide whether you want to save your files and is fairly slow.


				= Other =
-------------------------------------------------------------------------------

My personal favority is to swap all of Emacs out of memory.  I made a
duplicate copy of COMMAND.COM called C:\EMACS\COMMAND2.COM and I set the
secondary command shell equal to that duplicate file.  I own a utility, SHROOM
version 1.9c, that will swap Emacs to disk when Emacs spawns COMMAND2.COM.
Since I have it swap to a RAM disk, this is very fast. SHROOM can be found in
CompuServe's IBMSYS forum lib 3; unfortunately it is $hareware and fairly
expensive.


************************* Use C-Pg Up to return  ******************************
************************* Use Pg Up to scroll up ******************************
*******************************************************************************
